A database is a collection of data or facts organized in a systematic manner and persisted to a storage device by a database management system. The data can be structured according to a variety of methods or models. For example, a hierarchical data model associates each piece of knowledge with a record and places the records in a tree data structure such that each record is owned by only one entity. An extension of the hierarchical model is the network model that arranges the records in a graph data structure allowing for a record to have multiple parents and children. A database can also be represented using a simple flat-file model. In such a model, the information is stored in a plain text file with one record per line. XML is a popular format for storing hierarchical data. The most common model used today is the relational database model wherein mathematical relations based on set theory and predicate logic represent the data.
The organized nature of database data enables computer programs to easily and efficiently retrieve answers to questions. In particular, computer programs can create, manipulate and retrieve data from a database utilizing a query. For a relational database management system, the query can be formatted utilizing the structured query language (SQL). For example, to extract the complete customer records for all customers with the last name “Smith,” the SQL query expression could be formatted like SELECT * FROM customers WHERE lastname=‘Smith’. In this example, the keyword SELECT indicates the query is a retrieval query, the keyword FROM specifies which table of the database the data is to be found, in this case customers, and the keyword WHERE designates that only the rows with columns matching the given parameters should be returned.
In the event that XML is utilized to store data, a different query format is employed. XML Path Language (XPath) is a language recommended by the World Wide Web Consortium (W3C) for addressing portions of an XML document. In XPath, the previous SQL example would be formatted as xmlDoc.selectNodes(“//customer[lastname=Smith]”). In this example, the query returns all customer element nodes that have a lastname child node with the value “Smith.” The W3C is presently developing a language called XQuery that is built on XPath. XQuery is designed to query XML data to retrieve and manipulate data from XML documents or a data source capable of being viewed as XML data.